home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / dev / gcc / gcc263_src.lha / gcc-2.6.3 / gcc.info-21 < prev    next >
Encoding:
GNU Info File  |  1994-11-23  |  44.6 KB  |  1,007 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.55 from the input
  2. file gcc.texi.
  3.  
  4.    This file documents the use and the internals of the GNU compiler.
  5.  
  6.    Published by the Free Software Foundation 675 Massachusetts Avenue
  7. Cambridge, MA 02139 USA
  8.  
  9.    Copyright (C) 1988, 1989, 1992, 1993, 1994 Free Software Foundation,
  10. Inc.
  11.  
  12.    Permission is granted to make and distribute verbatim copies of this
  13. manual provided the copyright notice and this permission notice are
  14. preserved on all copies.
  15.  
  16.    Permission is granted to copy and distribute modified versions of
  17. this manual under the conditions for verbatim copying, provided also
  18. that the sections entitled "GNU General Public License," "Funding for
  19. Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
  20. included exactly as in the original, and provided that the entire
  21. resulting derived work is distributed under the terms of a permission
  22. notice identical to this one.
  23.  
  24.    Permission is granted to copy and distribute translations of this
  25. manual into another language, under the above conditions for modified
  26. versions, except that the sections entitled "GNU General Public
  27. License," "Funding for Free Software," and "Protect Your Freedom--Fight
  28. `Look And Feel'", and this permission notice, may be included in
  29. translations approved by the Free Software Foundation instead of in the
  30. original English.
  31.  
  32. 
  33. File: gcc.info,  Node: Condition Code,  Next: Costs,  Prev: Addressing Modes,  Up: Target Macros
  34.  
  35. Condition Code Status
  36. =====================
  37.  
  38.    This describes the condition code status.
  39.  
  40.    The file `conditions.h' defines a variable `cc_status' to describe
  41. how the condition code was computed (in case the interpretation of the
  42. condition code depends on the instruction that it was set by).  This
  43. variable contains the RTL expressions on which the condition code is
  44. currently based, and several standard flags.
  45.  
  46.    Sometimes additional machine-specific flags must be defined in the
  47. machine description header file.  It can also add additional
  48. machine-specific information by defining `CC_STATUS_MDEP'.
  49.  
  50. `CC_STATUS_MDEP'
  51.      C code for a data type which is used for declaring the `mdep'
  52.      component of `cc_status'.  It defaults to `int'.
  53.  
  54.      This macro is not used on machines that do not use `cc0'.
  55.  
  56. `CC_STATUS_MDEP_INIT'
  57.      A C expression to initialize the `mdep' field to "empty".  The
  58.      default definition does nothing, since most machines don't use the
  59.      field anyway.  If you want to use the field, you should probably
  60.      define this macro to initialize it.
  61.  
  62.      This macro is not used on machines that do not use `cc0'.
  63.  
  64. `NOTICE_UPDATE_CC (EXP, INSN)'
  65.      A C compound statement to set the components of `cc_status'
  66.      appropriately for an insn INSN whose body is EXP.  It is this
  67.      macro's responsibility to recognize insns that set the condition
  68.      code as a byproduct of other activity as well as those that
  69.      explicitly set `(cc0)'.
  70.  
  71.      This macro is not used on machines that do not use `cc0'.
  72.  
  73.      If there are insns that do not set the condition code but do alter
  74.      other machine registers, this macro must check to see whether they
  75.      invalidate the expressions that the condition code is recorded as
  76.      reflecting.  For example, on the 68000, insns that store in address
  77.      registers do not set the condition code, which means that usually
  78.      `NOTICE_UPDATE_CC' can leave `cc_status' unaltered for such insns.
  79.      But suppose that the previous insn set the condition code based
  80.      on location `a4@(102)' and the current insn stores a new value in
  81.      `a4'.  Although the condition code is not changed by this, it will
  82.      no longer be true that it reflects the contents of `a4@(102)'.
  83.      Therefore, `NOTICE_UPDATE_CC' must alter `cc_status' in this case
  84.      to say that nothing is known about the condition code value.
  85.  
  86.      The definition of `NOTICE_UPDATE_CC' must be prepared to deal with
  87.      the results of peephole optimization: insns whose patterns are
  88.      `parallel' RTXs containing various `reg', `mem' or constants which
  89.      are just the operands.  The RTL structure of these insns is not
  90.      sufficient to indicate what the insns actually do.  What
  91.      `NOTICE_UPDATE_CC' should do when it sees one is just to run
  92.      `CC_STATUS_INIT'.
  93.  
  94.      A possible definition of `NOTICE_UPDATE_CC' is to call a function
  95.      that looks at an attribute (*note Insn Attributes::.) named, for
  96.      example, `cc'.  This avoids having detailed information about
  97.      patterns in two places, the `md' file and in `NOTICE_UPDATE_CC'.
  98.  
  99. `EXTRA_CC_MODES'
  100.      A list of names to be used for additional modes for condition code
  101.      values in registers (*note Jump Patterns::.).  These names are
  102.      added to `enum machine_mode' and all have class `MODE_CC'.  By
  103.      convention, they should start with `CC' and end with `mode'.
  104.  
  105.      You should only define this macro if your machine does not use
  106.      `cc0' and only if additional modes are required.
  107.  
  108. `EXTRA_CC_NAMES'
  109.      A list of C strings giving the names for the modes listed in
  110.      `EXTRA_CC_MODES'.  For example, the Sparc defines this macro and
  111.      `EXTRA_CC_MODES' as
  112.  
  113.           #define EXTRA_CC_MODES CC_NOOVmode, CCFPmode, CCFPEmode
  114.           #define EXTRA_CC_NAMES "CC_NOOV", "CCFP", "CCFPE"
  115.  
  116.      This macro is not required if `EXTRA_CC_MODES' is not defined.
  117.  
  118. `SELECT_CC_MODE (OP, X, Y)'
  119.      Returns a mode from class `MODE_CC' to be used when comparison
  120.      operation code OP is applied to rtx X and Y.  For example, on the
  121.      Sparc, `SELECT_CC_MODE' is defined as (see *note Jump Patterns::.
  122.      for a description of the reason for this definition)
  123.  
  124.           #define SELECT_CC_MODE(OP,X,Y) \
  125.             (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT          \
  126.              ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode)    \
  127.              : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS    \
  128.                  || GET_CODE (X) == NEG) \
  129.                 ? CC_NOOVmode : CCmode))
  130.  
  131.      You need not define this macro if `EXTRA_CC_MODES' is not defined.
  132.  
  133. `CANONICALIZE_COMPARISON (CODE, OP0, OP1)'
  134.      One some machines not all possible comparisons are defined, but
  135.      you can convert an invalid comparison into a valid one.  For
  136.      example, the Alpha does not have a `GT' comparison, but you can
  137.      use an `LT' comparison instead and swap the order of the operands.
  138.  
  139.      On such machines, define this macro to be a C statement to do any
  140.      required conversions.  CODE is the initial comparison code and OP0
  141.      and OP1 are the left and right operands of the comparison,
  142.      respectively.  You should modify CODE, OP0, and OP1 as required.
  143.  
  144.      GNU CC will not assume that the comparison resulting from this
  145.      macro is valid but will see if the resulting insn matches a
  146.      pattern in the `md' file.
  147.  
  148.      You need not define this macro if it would never change the
  149.      comparison code or operands.
  150.  
  151. `REVERSIBLE_CC_MODE (MODE)'
  152.      A C expression whose value is one if it is always safe to reverse a
  153.      comparison whose mode is MODE.  If `SELECT_CC_MODE' can ever
  154.      return MODE for a floating-point inequality comparison, then
  155.      `REVERSIBLE_CC_MODE (MODE)' must be zero.
  156.  
  157.      You need not define this macro if it would always returns zero or
  158.      if the floating-point format is anything other than
  159.      `IEEE_FLOAT_FORMAT'.  For example, here is the definition used on
  160.      the Sparc, where floating-point inequality comparisons are always
  161.      given `CCFPEmode':
  162.  
  163.           #define REVERSIBLE_CC_MODE(MODE)  ((MODE) != CCFPEmode)
  164.  
  165. 
  166. File: gcc.info,  Node: Costs,  Next: Sections,  Prev: Condition Code,  Up: Target Macros
  167.  
  168. Describing Relative Costs of Operations
  169. =======================================
  170.  
  171.    These macros let you describe the relative speed of various
  172. operations on the target machine.
  173.  
  174. `CONST_COSTS (X, CODE, OUTER_CODE)'
  175.      A part of a C `switch' statement that describes the relative costs
  176.      of constant RTL expressions.  It must contain `case' labels for
  177.      expression codes `const_int', `const', `symbol_ref', `label_ref'
  178.      and `const_double'.  Each case must ultimately reach a `return'
  179.      statement to return the relative cost of the use of that kind of
  180.      constant value in an expression.  The cost may depend on the
  181.      precise value of the constant, which is available for examination
  182.      in X, and the rtx code of the expression in which it is contained,
  183.      found in OUTER_CODE.
  184.  
  185.      CODE is the expression code--redundant, since it can be obtained
  186.      with `GET_CODE (X)'.
  187.  
  188. `RTX_COSTS (X, CODE, OUTER_CODE)'
  189.      Like `CONST_COSTS' but applies to nonconstant RTL expressions.
  190.      This can be used, for example, to indicate how costly a multiply
  191.      instruction is.  In writing this macro, you can use the construct
  192.      `COSTS_N_INSNS (N)' to specify a cost equal to N fast
  193.      instructions.  OUTER_CODE is the code of the expression in which X
  194.      is contained.
  195.  
  196.      This macro is optional; do not define it if the default cost
  197.      assumptions are adequate for the target machine.
  198.  
  199. `ADDRESS_COST (ADDRESS)'
  200.      An expression giving the cost of an addressing mode that contains
  201.      ADDRESS.  If not defined, the cost is computed from the ADDRESS
  202.      expression and the `CONST_COSTS' values.
  203.  
  204.      For most CISC machines, the default cost is a good approximation
  205.      of the true cost of the addressing mode.  However, on RISC
  206.      machines, all instructions normally have the same length and
  207.      execution time.  Hence all addresses will have equal costs.
  208.  
  209.      In cases where more than one form of an address is known, the form
  210.      with the lowest cost will be used.  If multiple forms have the
  211.      same, lowest, cost, the one that is the most complex will be used.
  212.  
  213.      For example, suppose an address that is equal to the sum of a
  214.      register and a constant is used twice in the same basic block.
  215.      When this macro is not defined, the address will be computed in a
  216.      register and memory references will be indirect through that
  217.      register.  On machines where the cost of the addressing mode
  218.      containing the sum is no higher than that of a simple indirect
  219.      reference, this will produce an additional instruction and
  220.      possibly require an additional register.  Proper specification of
  221.      this macro eliminates this overhead for such machines.
  222.  
  223.      Similar use of this macro is made in strength reduction of loops.
  224.  
  225.      ADDRESS need not be valid as an address.  In such a case, the cost
  226.      is not relevant and can be any value; invalid addresses need not be
  227.      assigned a different cost.
  228.  
  229.      On machines where an address involving more than one register is as
  230.      cheap as an address computation involving only one register,
  231.      defining `ADDRESS_COST' to reflect this can cause two registers to
  232.      be live over a region of code where only one would have been if
  233.      `ADDRESS_COST' were not defined in that manner.  This effect should
  234.      be considered in the definition of this macro.  Equivalent costs
  235.      should probably only be given to addresses with different numbers
  236.      of registers on machines with lots of registers.
  237.  
  238.      This macro will normally either not be defined or be defined as a
  239.      constant.
  240.  
  241. `REGISTER_MOVE_COST (FROM, TO)'
  242.      A C expression for the cost of moving data from a register in class
  243.      FROM to one in class TO.  The classes are expressed using the
  244.      enumeration values such as `GENERAL_REGS'.  A value of 4 is the
  245.      default; other values are interpreted relative to that.
  246.  
  247.      It is not required that the cost always equal 2 when FROM is the
  248.      same as TO; on some machines it is expensive to move between
  249.      registers if they are not general registers.
  250.  
  251.      If reload sees an insn consisting of a single `set' between two
  252.      hard registers, and if `REGISTER_MOVE_COST' applied to their
  253.      classes returns a value of 2, reload does not check to ensure that
  254.      the constraints of the insn are met.  Setting a cost of other than
  255.      2 will allow reload to verify that the constraints are met.  You
  256.      should do this if the `movM' pattern's constraints do not allow
  257.      such copying.
  258.  
  259. `MEMORY_MOVE_COST (M)'
  260.      A C expression for the cost of moving data of mode M between a
  261.      register and memory.  A value of 2 is the default; this cost is
  262.      relative to those in `REGISTER_MOVE_COST'.
  263.  
  264.      If moving between registers and memory is more expensive than
  265.      between two registers, you should define this macro to express the
  266.      relative cost.
  267.  
  268. `BRANCH_COST'
  269.      A C expression for the cost of a branch instruction.  A value of 1
  270.      is the default; other values are interpreted relative to that.
  271.  
  272.    Here are additional macros which do not specify precise relative
  273. costs, but only that certain actions are more expensive than GNU CC
  274. would ordinarily expect.
  275.  
  276. `SLOW_BYTE_ACCESS'
  277.      Define this macro as a C expression which is nonzero if accessing
  278.      less than a word of memory (i.e. a `char' or a `short') is no
  279.      faster than accessing a word of memory, i.e., if such access
  280.      require more than one instruction or if there is no difference in
  281.      cost between byte and (aligned) word loads.
  282.  
  283.      When this macro is not defined, the compiler will access a field by
  284.      finding the smallest containing object; when it is defined, a
  285.      fullword load will be used if alignment permits.  Unless bytes
  286.      accesses are faster than word accesses, using word accesses is
  287.      preferable since it may eliminate subsequent memory access if
  288.      subsequent accesses occur to other fields in the same word of the
  289.      structure, but to different bytes.
  290.  
  291. `SLOW_ZERO_EXTEND'
  292.      Define this macro if zero-extension (of a `char' or `short' to an
  293.      `int') can be done faster if the destination is a register that is
  294.      known to be zero.
  295.  
  296.      If you define this macro, you must have instruction patterns that
  297.      recognize RTL structures like this:
  298.  
  299.           (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...)
  300.  
  301.      and likewise for `HImode'.
  302.  
  303. `SLOW_UNALIGNED_ACCESS'
  304.      Define this macro to be the value 1 if unaligned accesses have a
  305.      cost many times greater than aligned accesses, for example if they
  306.      are emulated in a trap handler.
  307.  
  308.      When this macro is non-zero, the compiler will act as if
  309.      `STRICT_ALIGNMENT' were non-zero when generating code for block
  310.      moves.  This can cause significantly more instructions to be
  311.      produced.  Therefore, do not set this macro non-zero if unaligned
  312.      accesses only add a cycle or two to the time for a memory access.
  313.  
  314.      If the value of this macro is always zero, it need not be defined.
  315.  
  316. `DONT_REDUCE_ADDR'
  317.      Define this macro to inhibit strength reduction of memory
  318.      addresses.  (On some machines, such strength reduction seems to do
  319.      harm rather than good.)
  320.  
  321. `MOVE_RATIO'
  322.      The number of scalar move insns which should be generated instead
  323.      of a string move insn or a library call.  Increasing the value
  324.      will always make code faster, but eventually incurs high cost in
  325.      increased code size.
  326.  
  327.      If you don't define this, a reasonable default is used.
  328.  
  329. `NO_FUNCTION_CSE'
  330.      Define this macro if it is as good or better to call a constant
  331.      function address than to call an address kept in a register.
  332.  
  333. `NO_RECURSIVE_FUNCTION_CSE'
  334.      Define this macro if it is as good or better for a function to call
  335.      itself with an explicit address than to call an address kept in a
  336.      register.
  337.  
  338. `ADJUST_COST (INSN, LINK, DEP_INSN, COST)'
  339.      A C statement (sans semicolon) to update the integer variable COST
  340.      based on the relationship between INSN that is dependent on
  341.      DEP_INSN through the dependence LINK.  The default is to make no
  342.      adjustment to COST.  This can be used for example to specify to
  343.      the scheduler that an output- or anti-dependence does not incur
  344.      the same cost as a data-dependence.
  345.  
  346. 
  347. File: gcc.info,  Node: Sections,  Next: PIC,  Prev: Costs,  Up: Target Macros
  348.  
  349. Dividing the Output into Sections (Texts, Data, ...)
  350. ====================================================
  351.  
  352.    An object file is divided into sections containing different types of
  353. data.  In the most common case, there are three sections: the "text
  354. section", which holds instructions and read-only data; the "data
  355. section", which holds initialized writable data; and the "bss section",
  356. which holds uninitialized data.  Some systems have other kinds of
  357. sections.
  358.  
  359.    The compiler must tell the assembler when to switch sections.  These
  360. macros control what commands to output to tell the assembler this.  You
  361. can also define additional sections.
  362.  
  363. `TEXT_SECTION_ASM_OP'
  364.      A C expression whose value is a string containing the assembler
  365.      operation that should precede instructions and read-only data.
  366.      Normally `".text"' is right.
  367.  
  368. `DATA_SECTION_ASM_OP'
  369.      A C expression whose value is a string containing the assembler
  370.      operation to identify the following data as writable initialized
  371.      data.  Normally `".data"' is right.
  372.  
  373. `SHARED_SECTION_ASM_OP'
  374.      if defined, a C expression whose value is a string containing the
  375.      assembler operation to identify the following data as shared data.
  376.      If not defined, `DATA_SECTION_ASM_OP' will be used.
  377.  
  378. `INIT_SECTION_ASM_OP'
  379.      if defined, a C expression whose value is a string containing the
  380.      assembler operation to identify the following data as
  381.      initialization code.  If not defined, GNU CC will assume such a
  382.      section does not exist.
  383.  
  384. `EXTRA_SECTIONS'
  385.      A list of names for sections other than the standard two, which are
  386.      `in_text' and `in_data'.  You need not define this macro on a
  387.      system with no other sections (that GCC needs to use).
  388.  
  389. `EXTRA_SECTION_FUNCTIONS'
  390.      One or more functions to be defined in `varasm.c'.  These
  391.      functions should do jobs analogous to those of `text_section' and
  392.      `data_section', for your additional sections.  Do not define this
  393.      macro if you do not define `EXTRA_SECTIONS'.
  394.  
  395. `READONLY_DATA_SECTION'
  396.      On most machines, read-only variables, constants, and jump tables
  397.      are placed in the text section.  If this is not the case on your
  398.      machine, this macro should be defined to be the name of a function
  399.      (either `data_section' or a function defined in `EXTRA_SECTIONS')
  400.      that switches to the section to be used for read-only items.
  401.  
  402.      If these items should be placed in the text section, this macro
  403.      should not be defined.
  404.  
  405. `SELECT_SECTION (EXP, RELOC)'
  406.      A C statement or statements to switch to the appropriate section
  407.      for output of EXP.  You can assume that EXP is either a `VAR_DECL'
  408.      node or a constant of some sort.  RELOC indicates whether the
  409.      initial value of EXP requires link-time relocations.  Select the
  410.      section by calling `text_section' or one of the alternatives for
  411.      other sections.
  412.  
  413.      Do not define this macro if you put all read-only variables and
  414.      constants in the read-only data section (usually the text section).
  415.  
  416. `SELECT_RTX_SECTION (MODE, RTX)'
  417.      A C statement or statements to switch to the appropriate section
  418.      for output of RTX in mode MODE.  You can assume that RTX is some
  419.      kind of constant in RTL.  The argument MODE is redundant except in
  420.      the case of a `const_int' rtx.  Select the section by calling
  421.      `text_section' or one of the alternatives for other sections.
  422.  
  423.      Do not define this macro if you put all constants in the read-only
  424.      data section.
  425.  
  426. `JUMP_TABLES_IN_TEXT_SECTION'
  427.      Define this macro if jump tables (for `tablejump' insns) should be
  428.      output in the text section, along with the assembler instructions.
  429.      Otherwise, the readonly data section is used.
  430.  
  431.      This macro is irrelevant if there is no separate readonly data
  432.      section.
  433.  
  434. `ENCODE_SECTION_INFO (DECL)'
  435.      Define this macro if references to a symbol must be treated
  436.      differently depending on something about the variable or function
  437.      named by the symbol (such as what section it is in).
  438.  
  439.      The macro definition, if any, is executed immediately after the
  440.      rtl for DECL has been created and stored in `DECL_RTL (DECL)'.
  441.      The value of the rtl will be a `mem' whose address is a
  442.      `symbol_ref'.
  443.  
  444.      The usual thing for this macro to do is to record a flag in the
  445.      `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
  446.      name string in the `symbol_ref' (if one bit is not enough
  447.      information).
  448.  
  449. `STRIP_NAME_ENCODING (VAR, SYM_NAME)'
  450.      Decode SYM_NAME and store the real name part in VAR, sans the
  451.      characters that encode section info.  Define this macro if
  452.      `ENCODE_SECTION_INFO' alters the symbol's name string.
  453.  
  454. 
  455. File: gcc.info,  Node: PIC,  Next: Assembler Format,  Prev: Sections,  Up: Target Macros
  456.  
  457. Position Independent Code
  458. =========================
  459.  
  460.    This section describes macros that help implement generation of
  461. position independent code.  Simply defining these macros is not enough
  462. to generate valid PIC; you must also add support to the macros
  463. `GO_IF_LEGITIMATE_ADDRESS' and `PRINT_OPERAND_ADDRESS', as well as
  464. `LEGITIMIZE_ADDRESS'.  You must modify the definition of `movsi' to do
  465. something appropriate when the source operand contains a symbolic
  466. address.  You may also need to alter the handling of switch statements
  467. so that they use relative addresses.
  468.  
  469. `PIC_OFFSET_TABLE_REGNUM'
  470.      The register number of the register used to address a table of
  471.      static data addresses in memory.  In some cases this register is
  472.      defined by a processor's "application binary interface" (ABI).
  473.      When this macro is defined, RTL is generated for this register
  474.      once, as with the stack pointer and frame pointer registers.  If
  475.      this macro is not defined, it is up to the machine-dependent files
  476.      to allocate such a register (if necessary).
  477.  
  478.      findex PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
  479.  
  480. `PIC_OFFSET_TABLE_REG_CALL_CLOBBERED'
  481.      Define this macro if the register defined by
  482.      `PIC_OFFSET_TABLE_REGNUM' is clobbered by calls.  Do not define
  483.      this macro if `PPIC_OFFSET_TABLE_REGNUM' is not defined.
  484.  
  485. `FINALIZE_PIC'
  486.      By generating position-independent code, when two different
  487.      programs (A and B) share a common library (libC.a), the text of
  488.      the library can be shared whether or not the library is linked at
  489.      the same address for both programs.  In some of these
  490.      environments, position-independent code requires not only the use
  491.      of different addressing modes, but also special code to enable the
  492.      use of these addressing modes.
  493.  
  494.      The `FINALIZE_PIC' macro serves as a hook to emit these special
  495.      codes once the function is being compiled into assembly code, but
  496.      not before.  (It is not done before, because in the case of
  497.      compiling an inline function, it would lead to multiple PIC
  498.      prologues being included in functions which used inline functions
  499.      and were compiled to assembly language.)
  500.  
  501. `LEGITIMATE_PIC_OPERAND_P (X)'
  502.      A C expression that is nonzero if X is a legitimate immediate
  503.      operand on the target machine when generating position independent
  504.      code.  You can assume that X satisfies `CONSTANT_P', so you need
  505.      not check this.  You can also assume FLAG_PIC is true, so you need
  506.      not check it either.  You need not define this macro if all
  507.      constants (including `SYMBOL_REF') can be immediate operands when
  508.      generating position independent code.
  509.  
  510. 
  511. File: gcc.info,  Node: Assembler Format,  Next: Debugging Info,  Prev: PIC,  Up: Target Macros
  512.  
  513. Defining the Output Assembler Language
  514. ======================================
  515.  
  516.    This section describes macros whose principal purpose is to describe
  517. how to write instructions in assembler language-rather than what the
  518. instructions do.
  519.  
  520. * Menu:
  521.  
  522. * File Framework::       Structural information for the assembler file.
  523. * Data Output::          Output of constants (numbers, strings, addresses).
  524. * Uninitialized Data::   Output of uninitialized variables.
  525. * Label Output::         Output and generation of labels.
  526. * Initialization::       General principles of initialization
  527.                and termination routines.
  528. * Macros for Initialization::
  529.              Specific macros that control the handling of
  530.                initialization and termination routines.
  531. * Instruction Output::   Output of actual instructions.
  532. * Dispatch Tables::      Output of jump tables.
  533. * Alignment Output::     Pseudo ops for alignment and skipping data.
  534.  
  535. 
  536. File: gcc.info,  Node: File Framework,  Next: Data Output,  Up: Assembler Format
  537.  
  538. The Overall Framework of an Assembler File
  539. ------------------------------------------
  540.  
  541.    This describes the overall framework of an assembler file.
  542.  
  543. `ASM_FILE_START (STREAM)'
  544.      A C expression which outputs to the stdio stream STREAM some
  545.      appropriate text to go at the start of an assembler file.
  546.  
  547.      Normally this macro is defined to output a line containing
  548.      `#NO_APP', which is a comment that has no effect on most
  549.      assemblers but tells the GNU assembler that it can save time by not
  550.      checking for certain assembler constructs.
  551.  
  552.      On systems that use SDB, it is necessary to output certain
  553.      commands; see `attasm.h'.
  554.  
  555. `ASM_FILE_END (STREAM)'
  556.      A C expression which outputs to the stdio stream STREAM some
  557.      appropriate text to go at the end of an assembler file.
  558.  
  559.      If this macro is not defined, the default is to output nothing
  560.      special at the end of the file.  Most systems don't require any
  561.      definition.
  562.  
  563.      On systems that use SDB, it is necessary to output certain
  564.      commands; see `attasm.h'.
  565.  
  566. `ASM_IDENTIFY_GCC (FILE)'
  567.      A C statement to output assembler commands which will identify the
  568.      object file as having been compiled with GNU CC (or another GNU
  569.      compiler).
  570.  
  571.      If you don't define this macro, the string `gcc_compiled.:' is
  572.      output.  This string is calculated to define a symbol which, on
  573.      BSD systems, will never be defined for any other reason.  GDB
  574.      checks for the presence of this symbol when reading the symbol
  575.      table of an executable.
  576.  
  577.      On non-BSD systems, you must arrange communication with GDB in
  578.      some other fashion.  If GDB is not used on your system, you can
  579.      define this macro with an empty body.
  580.  
  581. `ASM_COMMENT_START'
  582.      A C string constant describing how to begin a comment in the target
  583.      assembler language.  The compiler assumes that the comment will
  584.      end at the end of the line.
  585.  
  586. `ASM_APP_ON'
  587.      A C string constant for text to be output before each `asm'
  588.      statement or group of consecutive ones.  Normally this is
  589.      `"#APP"', which is a comment that has no effect on most assemblers
  590.      but tells the GNU assembler that it must check the lines that
  591.      follow for all valid assembler constructs.
  592.  
  593. `ASM_APP_OFF'
  594.      A C string constant for text to be output after each `asm'
  595.      statement or group of consecutive ones.  Normally this is
  596.      `"#NO_APP"', which tells the GNU assembler to resume making the
  597.      time-saving assumptions that are valid for ordinary compiler
  598.      output.
  599.  
  600. `ASM_OUTPUT_SOURCE_FILENAME (STREAM, NAME)'
  601.      A C statement to output COFF information or DWARF debugging
  602.      information which indicates that filename NAME is the current
  603.      source file to the stdio stream STREAM.
  604.  
  605.      This macro need not be defined if the standard form of output for
  606.      the file format in use is appropriate.
  607.  
  608. `ASM_OUTPUT_SOURCE_LINE (STREAM, LINE)'
  609.      A C statement to output DBX or SDB debugging information before
  610.      code for line number LINE of the current source file to the stdio
  611.      stream STREAM.
  612.  
  613.      This macro need not be defined if the standard form of debugging
  614.      information for the debugger in use is appropriate.
  615.  
  616. `ASM_OUTPUT_IDENT (STREAM, STRING)'
  617.      A C statement to output something to the assembler file to handle a
  618.      `#ident' directive containing the text STRING.  If this macro is
  619.      not defined, nothing is output for a `#ident' directive.
  620.  
  621. `ASM_OUTPUT_SECTION_NAME (STREAM, STRING)'
  622.      A C statement to output something to the assembler file to switch
  623.      to the section contained in STRING.  Some target formats do not
  624.      support arbitrary sections.  Do not define this macro in such
  625.      cases.
  626.  
  627.      At present this macro is only used to support section attributes.
  628.      When this macro is undefined, section attributes are disabled.
  629.  
  630. `OBJC_PROLOGUE'
  631.      A C statement to output any assembler statements which are
  632.      required to precede any Objective C object definitions or message
  633.      sending.  The statement is executed only when compiling an
  634.      Objective C program.
  635.  
  636. 
  637. File: gcc.info,  Node: Data Output,  Next: Uninitialized Data,  Prev: File Framework,  Up: Assembler Format
  638.  
  639. Output of Data
  640. --------------
  641.  
  642.    This describes data output.
  643.  
  644. `ASM_OUTPUT_LONG_DOUBLE (STREAM, VALUE)'
  645. `ASM_OUTPUT_DOUBLE (STREAM, VALUE)'
  646. `ASM_OUTPUT_FLOAT (STREAM, VALUE)'
  647. `ASM_OUTPUT_THREE_QUARTER_FLOAT (STREAM, VALUE)'
  648. `ASM_OUTPUT_SHORT_FLOAT (STREAM, VALUE)'
  649. `ASM_OUTPUT_BYTE_FLOAT (STREAM, VALUE)'
  650.      A C statement to output to the stdio stream STREAM an assembler
  651.      instruction to assemble a floating-point constant of `TFmode',
  652.      `DFmode', `SFmode', `TQFmode', `HFmode', or `QFmode',
  653.      respectively, whose value is VALUE.  VALUE will be a C expression
  654.      of type `REAL_VALUE_TYPE'.  Macros such as
  655.      `REAL_VALUE_TO_TARGET_DOUBLE' are useful for writing these
  656.      definitions.
  657.  
  658. `ASM_OUTPUT_QUADRUPLE_INT (STREAM, EXP)'
  659. `ASM_OUTPUT_DOUBLE_INT (STREAM, EXP)'
  660. `ASM_OUTPUT_INT (STREAM, EXP)'
  661. `ASM_OUTPUT_SHORT (STREAM, EXP)'
  662. `ASM_OUTPUT_CHAR (STREAM, EXP)'
  663.      A C statement to output to the stdio stream STREAM an assembler
  664.      instruction to assemble an integer of 16, 8, 4, 2 or 1 bytes,
  665.      respectively, whose value is VALUE.  The argument EXP will be an
  666.      RTL expression which represents a constant value.  Use
  667.      `output_addr_const (STREAM, EXP)' to output this value as an
  668.      assembler expression.
  669.  
  670.      For sizes larger than `UNITS_PER_WORD', if the action of a macro
  671.      would be identical to repeatedly calling the macro corresponding to
  672.      a size of `UNITS_PER_WORD', once for each word, you need not define
  673.      the macro.
  674.  
  675. `ASM_OUTPUT_BYTE (STREAM, VALUE)'
  676.      A C statement to output to the stdio stream STREAM an assembler
  677.      instruction to assemble a single byte containing the number VALUE.
  678.  
  679. `ASM_BYTE_OP'
  680.      A C string constant giving the pseudo-op to use for a sequence of
  681.      single-byte constants.  If this macro is not defined, the default
  682.      is `"byte"'.
  683.  
  684. `ASM_OUTPUT_ASCII (STREAM, PTR, LEN)'
  685.      A C statement to output to the stdio stream STREAM an assembler
  686.      instruction to assemble a string constant containing the LEN bytes
  687.      at PTR.  PTR will be a C expression of type `char *' and LEN a C
  688.      expression of type `int'.
  689.  
  690.      If the assembler has a `.ascii' pseudo-op as found in the Berkeley
  691.      Unix assembler, do not define the macro `ASM_OUTPUT_ASCII'.
  692.  
  693. `ASM_OUTPUT_POOL_PROLOGUE (FILE FUNNAME FUNDECL SIZE)'
  694.      A C statement to output assembler commands to define the start of
  695.      the constant pool for a function.  FUNNAME is a string giving the
  696.      name of the function.  Should the return type of the function be
  697.      required, it can be obtained via FUNDECL.  SIZE is the size, in
  698.      bytes, of the constant pool that will be written immediately after
  699.      this call.
  700.  
  701.      If no constant-pool prefix is required, the usual case, this macro
  702.      need not be defined.
  703.  
  704. `ASM_OUTPUT_SPECIAL_POOL_ENTRY (FILE, X, MODE, ALIGN, LABELNO, JUMPTO)'
  705.      A C statement (with or without semicolon) to output a constant in
  706.      the constant pool, if it needs special treatment.  (This macro
  707.      need not do anything for RTL expressions that can be output
  708.      normally.)
  709.  
  710.      The argument FILE is the standard I/O stream to output the
  711.      assembler code on.  X is the RTL expression for the constant to
  712.      output, and MODE is the machine mode (in case X is a `const_int').
  713.      ALIGN is the required alignment for the value X; you should
  714.      output an assembler directive to force this much alignment.
  715.  
  716.      The argument LABELNO is a number to use in an internal label for
  717.      the address of this pool entry.  The definition of this macro is
  718.      responsible for outputting the label definition at the proper
  719.      place.  Here is how to do this:
  720.  
  721.           ASM_OUTPUT_INTERNAL_LABEL (FILE, "LC", LABELNO);
  722.  
  723.      When you output a pool entry specially, you should end with a
  724.      `goto' to the label JUMPTO.  This will prevent the same pool entry
  725.      from being output a second time in the usual manner.
  726.  
  727.      You need not define this macro if it would do nothing.
  728.  
  729. `IS_ASM_LOGICAL_LINE_SEPARATOR (C)'
  730.      Define this macro as a C expression which is nonzero if C is used
  731.      as a logical line separator by the assembler.
  732.  
  733.      If you do not define this macro, the default is that only the
  734.      character `;' is treated as a logical line separator.
  735.  
  736. `ASM_OPEN_PAREN'
  737. `ASM_CLOSE_PAREN'
  738.      These macros are defined as C string constant, describing the
  739.      syntax in the assembler for grouping arithmetic expressions.  The
  740.      following definitions are correct for most assemblers:
  741.  
  742.           #define ASM_OPEN_PAREN "("
  743.           #define ASM_CLOSE_PAREN ")"
  744.  
  745.    These macros are provided by `real.h' for writing the definitions of
  746. `ASM_OUTPUT_DOUBLE' and the like:
  747.  
  748. `REAL_VALUE_TO_TARGET_SINGLE (X, L)'
  749. `REAL_VALUE_TO_TARGET_DOUBLE (X, L)'
  750. `REAL_VALUE_TO_TARGET_LONG_DOUBLE (X, L)'
  751.      These translate X, of type `REAL_VALUE_TYPE', to the target's
  752.      floating point representation, and store its bit pattern in the
  753.      array of `long int' whose address is L.  The number of elements in
  754.      the output array is determined by the size of the desired target
  755.      floating point data type: 32 bits of it go in each `long int' array
  756.      element.  Each array element holds 32 bits of the result, even if
  757.      `long int' is wider than 32 bits on the host machine.
  758.  
  759.      The array element values are designed so that you can print them
  760.      out using `fprintf' in the order they should appear in the target
  761.      machine's memory.
  762.  
  763. `REAL_VALUE_TO_DECIMAL (X, FORMAT, STRING)'
  764.      This macro converts X, of type `REAL_VALUE_TYPE', to a decimal
  765.      number and stores it as a string into STRING.  You must pass, as
  766.      STRING, the address of a long enough block of space to hold the
  767.      result.
  768.  
  769.      The argument FORMAT is a `printf'-specification that serves as a
  770.      suggestion for how to format the output string.
  771.  
  772. 
  773. File: gcc.info,  Node: Uninitialized Data,  Next: Label Output,  Prev: Data Output,  Up: Assembler Format
  774.  
  775. Output of Uninitialized Variables
  776. ---------------------------------
  777.  
  778.    Each of the macros in this section is used to do the whole job of
  779. outputting a single uninitialized variable.
  780.  
  781. `ASM_OUTPUT_COMMON (STREAM, NAME, SIZE, ROUNDED)'
  782.      A C statement (sans semicolon) to output to the stdio stream
  783.      STREAM the assembler definition of a common-label named NAME whose
  784.      size is SIZE bytes.  The variable ROUNDED is the size rounded up
  785.      to whatever alignment the caller wants.
  786.  
  787.      Use the expression `assemble_name (STREAM, NAME)' to output the
  788.      name itself; before and after that, output the additional
  789.      assembler syntax for defining the name, and a newline.
  790.  
  791.      This macro controls how the assembler definitions of uninitialized
  792.      global variables are output.
  793.  
  794. `ASM_OUTPUT_ALIGNED_COMMON (STREAM, NAME, SIZE, ALIGNMENT)'
  795.      Like `ASM_OUTPUT_COMMON' except takes the required alignment as a
  796.      separate, explicit argument.  If you define this macro, it is used
  797.      in place of `ASM_OUTPUT_COMMON', and gives you more flexibility in
  798.      handling the required alignment of the variable.  The alignment is
  799.      specified as the number of bits.
  800.  
  801. `ASM_OUTPUT_SHARED_COMMON (STREAM, NAME, SIZE, ROUNDED)'
  802.      If defined, it is similar to `ASM_OUTPUT_COMMON', except that it
  803.      is used when NAME is shared.  If not defined, `ASM_OUTPUT_COMMON'
  804.      will be used.
  805.  
  806. `ASM_OUTPUT_LOCAL (STREAM, NAME, SIZE, ROUNDED)'
  807.      A C statement (sans semicolon) to output to the stdio stream
  808.      STREAM the assembler definition of a local-common-label named NAME
  809.      whose size is SIZE bytes.  The variable ROUNDED is the size
  810.      rounded up to whatever alignment the caller wants.
  811.  
  812.      Use the expression `assemble_name (STREAM, NAME)' to output the
  813.      name itself; before and after that, output the additional
  814.      assembler syntax for defining the name, and a newline.
  815.  
  816.      This macro controls how the assembler definitions of uninitialized
  817.      static variables are output.
  818.  
  819. `ASM_OUTPUT_ALIGNED_LOCAL (STREAM, NAME, SIZE, ALIGNMENT)'
  820.      Like `ASM_OUTPUT_LOCAL' except takes the required alignment as a
  821.      separate, explicit argument.  If you define this macro, it is used
  822.      in place of `ASM_OUTPUT_LOCAL', and gives you more flexibility in
  823.      handling the required alignment of the variable.  The alignment is
  824.      specified as the number of bits.
  825.  
  826. `ASM_OUTPUT_SHARED_LOCAL (STREAM, NAME, SIZE, ROUNDED)'
  827.      If defined, it is similar to `ASM_OUTPUT_LOCAL', except that it is
  828.      used when NAME is shared.  If not defined, `ASM_OUTPUT_LOCAL' will
  829.      be used.
  830.  
  831. 
  832. File: gcc.info,  Node: Label Output,  Next: Initialization,  Prev: Uninitialized Data,  Up: Assembler Format
  833.  
  834. Output and Generation of Labels
  835. -------------------------------
  836.  
  837.    This is about outputting labels.
  838.  
  839. `ASM_OUTPUT_LABEL (STREAM, NAME)'
  840.      A C statement (sans semicolon) to output to the stdio stream
  841.      STREAM the assembler definition of a label named NAME.  Use the
  842.      expression `assemble_name (STREAM, NAME)' to output the name
  843.      itself; before and after that, output the additional assembler
  844.      syntax for defining the name, and a newline.
  845.  
  846. `ASM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL)'
  847.      A C statement (sans semicolon) to output to the stdio stream
  848.      STREAM any text necessary for declaring the name NAME of a
  849.      function which is being defined.  This macro is responsible for
  850.      outputting the label definition (perhaps using
  851.      `ASM_OUTPUT_LABEL').  The argument DECL is the `FUNCTION_DECL'
  852.      tree node representing the function.
  853.  
  854.      If this macro is not defined, then the function name is defined in
  855.      the usual manner as a label (by means of `ASM_OUTPUT_LABEL').
  856.  
  857. `ASM_DECLARE_FUNCTION_SIZE (STREAM, NAME, DECL)'
  858.      A C statement (sans semicolon) to output to the stdio stream
  859.      STREAM any text necessary for declaring the size of a function
  860.      which is being defined.  The argument NAME is the name of the
  861.      function.  The argument DECL is the `FUNCTION_DECL' tree node
  862.      representing the function.
  863.  
  864.      If this macro is not defined, then the function size is not
  865.      defined.
  866.  
  867. `ASM_DECLARE_OBJECT_NAME (STREAM, NAME, DECL)'
  868.      A C statement (sans semicolon) to output to the stdio stream
  869.      STREAM any text necessary for declaring the name NAME of an
  870.      initialized variable which is being defined.  This macro must
  871.      output the label definition (perhaps using `ASM_OUTPUT_LABEL').
  872.      The argument DECL is the `VAR_DECL' tree node representing the
  873.      variable.
  874.  
  875.      If this macro is not defined, then the variable name is defined in
  876.      the usual manner as a label (by means of `ASM_OUTPUT_LABEL').
  877.  
  878. `ASM_FINISH_DECLARE_OBJECT (STREAM, DECL, TOPLEVEL, ATEND)'
  879.      A C statement (sans semicolon) to finish up declaring a variable
  880.      name once the compiler has processed its initializer fully and
  881.      thus has had a chance to determine the size of an array when
  882.      controlled by an initializer.  This is used on systems where it's
  883.      necessary to declare something about the size of the object.
  884.  
  885.      If you don't define this macro, that is equivalent to defining it
  886.      to do nothing.
  887.  
  888. `ASM_GLOBALIZE_LABEL (STREAM, NAME)'
  889.      A C statement (sans semicolon) to output to the stdio stream
  890.      STREAM some commands that will make the label NAME global; that
  891.      is, available for reference from other files.  Use the expression
  892.      `assemble_name (STREAM, NAME)' to output the name itself; before
  893.      and after that, output the additional assembler syntax for making
  894.      that name global, and a newline.
  895.  
  896. `ASM_OUTPUT_EXTERNAL (STREAM, DECL, NAME)'
  897.      A C statement (sans semicolon) to output to the stdio stream
  898.      STREAM any text necessary for declaring the name of an external
  899.      symbol named NAME which is referenced in this compilation but not
  900.      defined.  The value of DECL is the tree node for the declaration.
  901.  
  902.      This macro need not be defined if it does not need to output
  903.      anything.  The GNU assembler and most Unix assemblers don't
  904.      require anything.
  905.  
  906. `ASM_OUTPUT_EXTERNAL_LIBCALL (STREAM, SYMREF)'
  907.      A C statement (sans semicolon) to output on STREAM an assembler
  908.      pseudo-op to declare a library function name external.  The name
  909.      of the library function is given by SYMREF, which has type `rtx'
  910.      and is a `symbol_ref'.
  911.  
  912.      This macro need not be defined if it does not need to output
  913.      anything.  The GNU assembler and most Unix assemblers don't
  914.      require anything.
  915.  
  916. `ASM_OUTPUT_LABELREF (STREAM, NAME)'
  917.      A C statement (sans semicolon) to output to the stdio stream
  918.      STREAM a reference in assembler syntax to a label named NAME.
  919.      This should add `_' to the front of the name, if that is customary
  920.      on your operating system, as it is in most Berkeley Unix systems.
  921.      This macro is used in `assemble_name'.
  922.  
  923. `ASM_OUTPUT_INTERNAL_LABEL (STREAM, PREFIX, NUM)'
  924.      A C statement to output to the stdio stream STREAM a label whose
  925.      name is made from the string PREFIX and the number NUM.
  926.  
  927.      It is absolutely essential that these labels be distinct from the
  928.      labels used for user-level functions and variables.  Otherwise,
  929.      certain programs will have name conflicts with internal labels.
  930.  
  931.      It is desirable to exclude internal labels from the symbol table
  932.      of the object file.  Most assemblers have a naming convention for
  933.      labels that should be excluded; on many systems, the letter `L' at
  934.      the beginning of a label has this effect.  You should find out what
  935.      convention your system uses, and follow it.
  936.  
  937.      The usual definition of this macro is as follows:
  938.  
  939.           fprintf (STREAM, "L%s%d:\n", PREFIX, NUM)
  940.  
  941. `ASM_GENERATE_INTERNAL_LABEL (STRING, PREFIX, NUM)'
  942.      A C statement to store into the string STRING a label whose name
  943.      is made from the string PREFIX and the number NUM.
  944.  
  945.      This string, when output subsequently by `assemble_name', should
  946.      produce the output that `ASM_OUTPUT_INTERNAL_LABEL' would produce
  947.      with the same PREFIX and NUM.
  948.  
  949.      If the string begins with `*', then `assemble_name' will output
  950.      the rest of the string unchanged.  It is often convenient for
  951.      `ASM_GENERATE_INTERNAL_LABEL' to use `*' in this way.  If the
  952.      string doesn't start with `*', then `ASM_OUTPUT_LABELREF' gets to
  953.      output the string, and may change it.  (Of course,
  954.      `ASM_OUTPUT_LABELREF' is also part of your machine description, so
  955.      you should know what it does on your machine.)
  956.  
  957. `ASM_FORMAT_PRIVATE_NAME (OUTVAR, NAME, NUMBER)'
  958.      A C expression to assign to OUTVAR (which is a variable of type
  959.      `char *') a newly allocated string made from the string NAME and
  960.      the number NUMBER, with some suitable punctuation added.  Use
  961.      `alloca' to get space for the string.
  962.  
  963.      The string will be used as an argument to `ASM_OUTPUT_LABELREF' to
  964.      produce an assembler label for an internal static variable whose
  965.      name is NAME.  Therefore, the string must be such as to result in
  966.      valid assembler code.  The argument NUMBER is different each time
  967.      this macro is executed; it prevents conflicts between
  968.      similarly-named internal static variables in different scopes.
  969.  
  970.      Ideally this string should not be a valid C identifier, to prevent
  971.      any conflict with the user's own symbols.  Most assemblers allow
  972.      periods or percent signs in assembler symbols; putting at least
  973.      one of these between the name and the number will suffice.
  974.  
  975. `ASM_OUTPUT_DEF (STREAM, NAME, VALUE)'
  976.      A C statement to output to the stdio stream STREAM assembler code
  977.      which defines (equates) the symbol NAME to have the value VALUE.
  978.  
  979.      If SET_ASM_OP is defined, a default definition is provided which is
  980.      correct for most systems.
  981.  
  982. `OBJC_GEN_METHOD_LABEL (BUF, IS_INST, CLASS_NAME, CAT_NAME, SEL_NAME)'
  983.      Define this macro to override the default assembler names used for
  984.      Objective C methods.
  985.  
  986.      The default name is a unique method number followed by the name of
  987.      the class (e.g. `_1_Foo').  For methods in categories, the name of
  988.      the category is also included in the assembler name (e.g.
  989.      `_1_Foo_Bar').
  990.  
  991.      These names are safe on most systems, but make debugging difficult
  992.      since the method's selector is not present in the name.
  993.      Therefore, particular systems define other ways of computing names.
  994.  
  995.      BUF is an expression of type `char *' which gives you a buffer in
  996.      which to store the name; its length is as long as CLASS_NAME,
  997.      CAT_NAME and SEL_NAME put together, plus 50 characters extra.
  998.  
  999.      The argument IS_INST specifies whether the method is an instance
  1000.      method or a class method; CLASS_NAME is the name of the class;
  1001.      CAT_NAME is the name of the category (or NULL if the method is not
  1002.      in a category); and SEL_NAME is the name of the selector.
  1003.  
  1004.      On systems where the assembler can handle quoted names, you can
  1005.      use this macro to provide more human-readable names.
  1006.  
  1007.